# # 字典
# books = {'title': 'Python入门', 'price': 45}
# # print(books, type(books), books['price'])
# books['price'] = 45 * 0.88
# print(books['price'])
# books['author'] = 'somebody'
# print(books)
# del books['author']
# print(books)

# # 遍历字典
# for key in books:
#     print(books[key])

# print(dir(books))

# dd = {
#     'borisakunin': 4691,
#     'doctor_liza': 3046,
#     'tareeva': 2970,
#     'cheger': 2887,
#     'karial': 2717,
#     'snorapp': 2707,
#     'masha_koroleva': 2683,
#     'elladkin': 2616,
#     'samoleg': 2597
# }
# print(sorted(dd.keys()))

# # 分支语句

# tall = float(input('请输入您的身高（m）：'))
# weight = float(input('请输入您的体重（kg): '))
# bmi = weight / (tall * tall)
# # bmi = 12
# # if (bmi >= 11 and bmi < 21):
# #     print('你的体重正常')
# # else:
# #     print('你的体重不正常')
# print(bmi.__round__(2))
# if bmi < 18.5:
#     print('你有些偏瘦')
# elif (bmi >= 18.5 and bmi <= 23.9):
#     print('你的体重正常')
# elif (bmi > 23.9 and bmi < 28):
#     print('你有点偏胖')
# else:
#     print('你现在是肥胖人士！')

# 循环
# str1 = '这是一个字符串'
# for i in str1:
#     print(i)

# for i in range(1, 10, 2):
#     print(i)

# count = 0

# while count < 10:
#     print(count)
#     count += 1


# 函数
def bmi(tall, weight):
    return weight / (tall * tall)


def diagBMI(bmi):
    if (bmi >= 18.5 and bmi < 23.9):
        print('你的体重正常')
    else:
        print('你的体重不正常')


# print(bmi(1.7, 65))
# print(bmi(1.7, 50))
# diagBMI(bmi(1.7, 65))


# 类
class Person:
    def __init__(self, name):
        self.name = name

    def whoami(self):
        return "You are " + self.name


print(Person)

p1 = Person('tom')
print(p1.whoami())
print(p1.name)
